package com.example.userlogincenter.userCenter.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @TableName apikey_info
 */
@TableName(value ="apikey_info")
@Data
public class ApikeyInfo implements Serializable {
    /**
     * apiKey id
     */
    @TableField("ak_id")
    private Long akId;

    /**
     * apikey
     */
    @TableField("ak_key")
    private String akKey;

    /**
     * apikey密码
     */
    @TableField("ak_secret")
    private String akSecret;

    /**
     * 是否永久有效
     */
    @TableField("ak_forever")
    private Integer akForever;

    /**
     * 关联用户Id
     */
    @TableField("ak_memberid")
    private Long akMemberid;

    /**
     * apiKey开始日期
     */
    @TableField("ak_startDate")
    private Date akStartdate;

    /**
     * apiKey有效日期
     */
    @TableField("ak_enddate")
    private Date akEnddate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ApikeyInfo other = (ApikeyInfo) that;
        return (this.getAkId() == null ? other.getAkId() == null : this.getAkId().equals(other.getAkId()))
            && (this.getAkKey() == null ? other.getAkKey() == null : this.getAkKey().equals(other.getAkKey()))
            && (this.getAkSecret() == null ? other.getAkSecret() == null : this.getAkSecret().equals(other.getAkSecret()))
            && (this.getAkForever() == null ? other.getAkForever() == null : this.getAkForever().equals(other.getAkForever()))
            && (this.getAkMemberid() == null ? other.getAkMemberid() == null : this.getAkMemberid().equals(other.getAkMemberid()))
            && (this.getAkStartdate() == null ? other.getAkStartdate() == null : this.getAkStartdate().equals(other.getAkStartdate()))
            && (this.getAkEnddate() == null ? other.getAkEnddate() == null : this.getAkEnddate().equals(other.getAkEnddate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAkId() == null) ? 0 : getAkId().hashCode());
        result = prime * result + ((getAkKey() == null) ? 0 : getAkKey().hashCode());
        result = prime * result + ((getAkSecret() == null) ? 0 : getAkSecret().hashCode());
        result = prime * result + ((getAkForever() == null) ? 0 : getAkForever().hashCode());
        result = prime * result + ((getAkMemberid() == null) ? 0 : getAkMemberid().hashCode());
        result = prime * result + ((getAkStartdate() == null) ? 0 : getAkStartdate().hashCode());
        result = prime * result + ((getAkEnddate() == null) ? 0 : getAkEnddate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", akId=").append(akId);
        sb.append(", akKey=").append(akKey);
        sb.append(", akSecret=").append(akSecret);
        sb.append(", akForever=").append(akForever);
        sb.append(", akMemberid=").append(akMemberid);
        sb.append(", akStartdate=").append(akStartdate);
        sb.append(", akEnddate=").append(akEnddate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}